import java.net.*;
import java.io.*;

public class MultiSocketServer{
	
	MultiSocketServer(){
		
	}
	
	public static void main(String[] args){
        ServerSocket serverSocket = null;
        boolean listening = true;

        try {
            serverSocket = new ServerSocket(4444);
        } catch (IOException e) {
            System.err.println("Could not listen on port: 4444.");
            System.exit(-1);
        }

        while (listening){
        	try {
				new MultiServerThread(serverSocket.accept()).start();
			} catch (IOException e) {
				e.printStackTrace();
			}
        }
        try {
			serverSocket.close();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
}